using System.Collections;
using System.Collections.Generic;
using QFramework;
using UnityEngine;


namespace AsterroidX
{
    public class GameModel : AbstractModel
    {

        public BindableProperty<int> Score;


        public  float PowerUpGenerateDuration = 10;


        public BindableProperty<int> BestScore;

        public BindableProperty<int> RockKillCount;

        public BindableProperty<bool> Paused;

        public bool GameRunning => !Paused.Value;

        public float BaseRockSpeed;

        public float RockSpeedRate;

        public int MaxRockCount;

        public bool PowerUpRepetScreen;

        public int UFOLevel;

        public Vector2 TornadoCenter=Vector2.zero;

        public int TornadoBulletCount = 0;


        public int BulletCount = 0;


        public Queue<Bullet>CacheBullet=new Queue<Bullet>();

        public int RockCount;

        public BindableProperty<float> SecondsToGamePass = new BindableProperty<float>(Config.InitSecondsToGamePass);

        public bool GamePass = false;


        public BindableProperty<float> GameSeconds = new BindableProperty<float>(0);

        public BindableProperty<int> UFOKillCount = new BindableProperty<int>(0);

        protected override void OnInit()
        {

            var storage = this.GetUtility<StorageUtility>();

         
            Score =new BindableProperty<int> {Value = 0 };

            RockKillCount=new BindableProperty<int>{Value = 0};

            Paused=new BindableProperty<bool>{Value = false};

            PowerUpRepetScreen = false;

            BaseRockSpeed = 1;

            RockSpeedRate=0.5f;

            MaxRockCount = 6;

            UFOLevel = 1;


            RockCount = 0;

            var loadBestScore = storage.LoadInt(nameof(BestScore), 0);
            BestScore =new BindableProperty<int>(){Value = loadBestScore };
        }
    }

}
